package lry.sql;

import com.lry.message.Message;
import com.lry.producer.DefaultMqProducer;
import com.lry.producer.SendResult;

import java.nio.charset.StandardCharsets;

public class BasicProducer {

    public static void main(String[] args) throws InterruptedException {

        DefaultMqProducer producer = new DefaultMqProducer("localhost:8084");
        producer.start();

        for(int i=0;i<1000000;i++){
            Message message = new Message();
            message.putUserProperty("a","-1");
            message.setBody(("hello world"+i).getBytes(StandardCharsets.UTF_8));
            message.setTopic("topic");
            SendResult result = producer.send(message);
            System.out.println(result);

            Thread.sleep(1000);
        }
    }
}
